package com.taotao.controller;

import com.taotao.entity.User;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author wangjin
 * @title: LoginIndexController
 * @projectName wj-sc
 * @description:
 * @date 2021/10/27 9:16
 */
@RestController
public class LoginIndexController {
    @Value("${server.port}")
    private String sport;

    @RequestMapping("/login")
    public String login() {
        return sport + "login";
    }

    /**
     * 传递 String  类型的值
     *
     * @param name
     * @return
     */
    @RequestMapping("/getName")
    public String getName(String name) {
        return "feign传递参数" + name;
    }

    /**
     * feign 多个参数传值
     *
     * @param name
     * @param pass
     * @return
     */
    @RequestMapping("/getNameMore")
    public String getNameMore(@RequestParam("name") String name, @RequestParam(value = "pass") String pass) {
        return "feign传递多参数的值" + name + pass;
    }


    /**
     * feign 传递 module l类型的值
     *
     * @param user
     * @return
     */
    @RequestMapping("/getUser")
    public String getUser(@RequestBody User user) {
        return "feign传递model类型的值" + user.getName() + user.getPass();
    }
}
